﻿using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Framework.Reflection;
using Pixysoft.Weblications.Sango.Environment;
using Pixysoft.Weblications.Sango.Dao;
using Pixysoft.Weblications.Sango.Protocol.stage;
using Pixysoft.Weblications.Sango.Protocol;
using Pixysoft.Weblications.Sango.Battle;
using Pixysoft.Weblications.Sango.Protocol.player;

namespace Pixysoft.Weblications.Sango.Command.stage_rve
{
    partial class SangoStageRveHandler
    {
        /// <summary>
        /// 根据用户所在的地理位置，获取战斗排程列表
        /// </summary>
        /// <returns></returns>
        public stagerve_roomlist stagerve_roomlist(double geox, double geoy, long stageserialcode)
        {
            string userCode = SangoManager.Authentication();

            stagerve_roomlist response = ReflectionManager.CreatePojo<stagerve_roomlist>();
            response.Succeed = false;

            Entities.Sys_Section sysSection = SysSectionHelper.trySearchSectionByGeolocation(geox, geoy);
            Entities.Cti_Section ctiSection = CitySectionHelper.searchSectionByCode(sysSection.Sectionserialcode);
            Entities.Usr_Property property = UsrPropertyDao.getProperty(userCode);
            long mapcode = property.Mapserialcode;

            Entities.War_Stage warstage = WarStageHelper.searchStageByCode(stageserialcode);
            response.stage = StageFacade.ToRveStage(warstage);


            List<RveStageTeam> teams = RveStageController.Instance.GetTeams(stageserialcode, sysSection.Sectionserialcode);
            response.teams = StageFacade.ToRveTeams(teams);

            response.geosection = UsrSectionFacade.ToSection(sysSection, ctiSection);

            response.Succeed = true;
            return response;
        }

    }
    public interface stagerve_roomlist : ISangoResponse
    {
        player_section geosection { get;set;}
        stage_rvestage stage { get;set;}
        List<stage_rveteam> teams { get;set;}
    }
}
